<?php

namespace app\backstage\validate;

use think\Validate;

class PowerValidate extends Validate
{
    protected $rule = [
        'id' => 'require|number|gt:0',
        'title' => 'require|max:20',
        'status' => 'require|in:0,1',
        'alias' => 'require|max:20',
        'parent_node_id' => 'require|number|egt:0',
        'field' => 'require|in:node_path,permission_id,order,type,status,title,permission_id,icon',
        'value' => 'max:50',
        'role_id' => 'require|number|gt:0',
        'checked' => 'require|in:0,1',
    ];

    protected $message = [
    ];

    protected $scene = [
        'editRole' => ['id', 'title', 'status', 'alias'],
        'addNode' => ['parent_node_id'],
        'upNode' => ['id', 'field', 'value'],
        'delNode' => ['id'],
        'authNode' => ['id', 'role_id', 'checked'],
    ];
}